﻿@{
    var title = "Управление";
    ViewBag.Title = title;
}
<div class="title">
    <h2>@title</h2>
</div>
<div id="mainManagePanel">
    @Html.ActionLink("Запустить", "StartAllTests", "Manage")
    @Html.ActionLink("Остановить", "StopAllTests", "Manage")
    @Html.ActionLink("Сохранить", "Manage", "Manage", null, new { @class = "popup-link-saveState"})
    @Html.ActionLink("Загрузить", "Manage", "Manage", null, new { @class = "popup-link-loadState"})
</div>

@Html.Partial(@"PopUps\SavePopUp")
@Html.Partial(@"PopUps\LoadPopUp")

@using (Html.BeginForm("AddRemoteDevice", "Manage", FormMethod.Post))
{
    @Html.TextBox("newDeviceName", null, new { required = "required", placeholder="Введите имя устройства", size="30" });
    <input class="btn" type="submit" value="Добавить устройство" />
}

@{
    if (ViewBag.Names != null)
    {
        int popupBoxCounter = 0;
        foreach (string name in ViewBag.Names)
        {
            popupBoxCounter++;
            if (!String.IsNullOrEmpty(name))
            {
    <p>
        @Html.ActionLink(HttpUtility.HtmlDecode("&times;"),
                         "Manage",
                         "Manage",
                         new { devName = name },
                                      new { devName = name, @class = "popup-link-" + popupBoxCounter, @id = "deleteSignCross" })
        @Html.ActionLink(name,
                        "DeviceProperty",
                        "Manage",
                        new { devName = name },
                        new { devName = name, @id="devicePropLink" })
    </p>
    
    <div class="popup-box" id="popup-box-@popupBoxCounter">
        <div class="close">
            &times;</div>
        <div class="top">
            <h2>
                Подтверждение</h2>
        </div>
        <div class="bottom">
            Вы точно хотите удалить устройство "<b>@name</b>"?<br />
            <br />
            <div class="yesNo">
                @Html.ActionLink("Да", "RemoveRemoteDevice", "Manage", new { devName = name }, new { devName = name })
                @Html.ActionLink("Нет", "Manage")
            </div>
        </div>
    </div>        
    
            }
        }
    }
}
